package com.hn658.base.message.notisender.message;

import java.sql.Timestamp;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.hn658.base.message.common.enums.NotifySenderType;
import com.hn658.base.message.notisender.enums.NotifyPriority;
import com.hn658.framework.common.AbstractBaseDTO;
import com.hn658.framework.shared.entity.BaseEntity;
import com.hn658.framework.shared.utils.UUIDUtils;

/**
 * 模    块：NotificationMessage
 * 包    名：com.wzitech.chaos.gaea.dada.notification.common.context.message
 * 项目名称：dada
 * 作    者：Shawn
 * 创建时间：10/25/13 2:27 AM
 * 描    述：
 * 更新纪录：1. Shawn 创建于 10/25/13 2:27 AM
 */
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
public abstract class NotificationMessage extends BaseEntity {

	private static final long serialVersionUID = 5284966344856601028L;

	
	private String uid;
	
	private String appId;
	/**
     * 消息Id
     */
    private String notifyId;

    /**
     * 事件类型
     */
    private NotifySenderType type;

    /**
     * 事件处理优先级
     */
    private NotifyPriority priority;

    /**
     * 消息主题
     */
    private String topic;

    /**
     * 发送者
     */
    private String from;

    /**
     * 接收者
     */
    private String destination;

    /**
     * 内容
     */
    private String content;

    /**
     * 创建通知消息时间
     */
    private Timestamp createdDateTime;

    /**
     * 通知时间
     */
    private Timestamp notifyDateTime;
    

    public NotificationMessage(NotifySenderType type, NotifyPriority priority){
        this.notifyId = UUIDUtils.getUUID().toString().replace("-", "");
        this.type = type;
        this.priority = priority;
        this.createdDateTime = new Timestamp(System.currentTimeMillis());
    }

    /**
     * 从实体对象中获取信息
     * @param source
     */
    public abstract void convertFromEntity(AbstractBaseDTO source);


    public NotifySenderType getType() {
        return type;
    }

    public void setType(NotifySenderType type) {
        this.type = type;
    }

    /**
     * @return the priority
     */
    public NotifyPriority getPriority() {
        return priority;
    }

    /**
     * @param priority the priority to set
     */
    public void setPriority(NotifyPriority priority) {
        this.priority = priority;
    }

    /**
     * @return the id
     */
    public String getNotifyIdId() {
        return notifyId;
    }

    /**
     * @param notifyId the notifyId to set
     */
    public void setNotifyId(String notifyId) {
        this.notifyId = notifyId;
    }

    /**
     * 通知主题
     */
    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    /**
     * 通知目标
     * 可以设置多个收件人，用半角逗号隔开
     */
    public String getDestination() {
        return destination;
    }

    public void setDestination(String destination) {
        this.destination = destination;
    }

    /**
     * 通知内容
     */
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    /**
     * 创建时间
     */
    public Timestamp getCreatedDateTime() {
        return createdDateTime;
    }

    public void setCreatedDateTime(Timestamp createdDateTime) {
        this.createdDateTime = createdDateTime;
    }

    /**
     * 通知发送时间
     */
    public Timestamp getNotifyDateTime() {
        return notifyDateTime;
    }

    public void setNotifyDateTime(Timestamp notifyDateTime) {
        this.notifyDateTime = notifyDateTime;
    }

    /**
     * 通知发送方
     */
    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}
    
}
